#!/usr/bin/env bash
################################################################################
# nojoy - log your thoughts when you fail                                      #
#                                                                              #
# @author    David Christian Liedle <david.liedle@gmail.com>                   #
# @copyright Copyright (c) 2008-2011 David Christian Liedle.                   #
# @license   MIT Open Source License / CC-BY 3.0                               #
#             http://www.opensource.org/licenses/mit-license.php               #
#              http://creativecommons.org/licenses/by/3.0/                     #
#                                                                              #
#  Released as part of The CLIMAX/Candy Suite: http://climax.googlecode.com/   #
#                                                                              #
################################################################################

dogetprompt(){
    echo -n "> "
}

echo
echo "Aww... what happened?"
dogetprompt
read WHATHAPPENED

echo
echo "What caused the problem?"
dogetprompt
read PROBLEMCAUSE

echo
echo "...and what are you going to do about it?"
dogetprompt
read THEPLAN

echo
echo "Ok, I'll jot that all down for you in ~/.nojoy"
echo -e "`date`\nEvent: $WHATHAPPENED\nCause: $PROBLEMCAUSE\nPlanA: $THEPLAN\n\n" >> ~/.nojoy

echo
echo "Hang in there!"
echo
exit 0
